# -*- mode: python; coding: utf-8; -*-
##--------------------------------------------------------------------------##
##
## Copyright (C) 1998-2003 Markus Oberhumer <markus@oberhumer.com>
## Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2010 Skomoroh <skomoroh@users.sourceforge.net>
## Copyright (C) 2010-2013 Jeremy Austin-Bardo <tjaustinbardo@gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <http://www.gnu.org/licenses/>.
##
##--------------------------------------------------------------------------##
__docformat__ = "restructuredtext en"
__all__ = []

from ... import pilelib as stack
from ...gamelib import info as gi
from ...packlib import info as cs
from ...utillib.misc import kwdefault
from .. import braid

Wrap = stack.StackWrapper
GT, SL = gi.GT, gi.SL


class Ponytail(cs.Tarock_Deck, braid.Braid):
    """
    Finish 1 deck on foundation.

    :CVariables:
      _layout_ : pysollib.layout.Layout
        ..pysollib.layouts.napolean.BraidSmallLayout
        - row [6 over 2 cols E, 6 over 2 cols W braid, no offset]
        - reserve [2 N 2 S row E, 2 N 2 S row W braid, no offset]
        - braid [1 N, braid offset]
        - talon [1 E foundation, no offset]
        - waste [1 E talon, no offset]
        - foundation [10 over 2 col E, no offset]

      _talon_ : pysollib.stack.Stack
        .. stack.WasteTalon (max_rounds=3)
        Deal 1 card per `s.waste` on click. 2 redeal.

      _waste_ : pysollib.stack.Stack
        .. stack.WasteStack
        Init 1 card. Build none. Play top.

      _foundation_ : pysollib.stack.Stack
        .. pysollib.stacks.napoleon.Foundation
        Init non trump base card. Build in rank by same suit wrap from
        base card. Dir determined by 2nd card on any pile. Play top. No trump.

      _row_ : pysollib.stack.Stack
        .. pysollib.stacks.napoleon.RowStack
        Init 1 card. Build any from any but reserve or braid. Play
        top. Max 1 card.

      _reserve_ : pysollib.stack.Stack
        .. pysollib.stacks.napoleon.Reserve
        Init 1 card. Play top. Gap deal 1 card from braid. Max 1 card.

      _braid_ : pysollib.stack.Stack
        .. pysollib.stack.OpenStack (max_cards=20)
        Init deal 20 open card. Build none. Play top.

      _hint_ : pysollib.hint.AbstractHint
        .. pysollib.hint.CautiousDefaultHint
    """
    __info__ = dict(id=179, name="Ponytail", category=cs.TYPE_TAROCK,
                    game_type=GT.NAPOLEON, decks=2, redeals=2,
                    skill_level=SL.MOSTLY_SKILL, version='4.30')
    __author__ = 'Markus Oberhumer'
    __version__ = 7.70

    def _create_game(self, **kw):
        """
        _create_game([rows=12, reserves=8]) -> Layout

        Add a canvas info label for base_rank next to talon.

        :returns: current layout with piles and their texts set.

        :seealso: `pysollib.layouts.napoleon` for keyword definitions.
        """
        kwdefault(kw, rows=12, reserves=8)
        return super(Ponytail, **kw)._create_game(**kw)


PROVIDES = [Ponytail]